using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace SailHero.Soft.FrameWork.Models.Mapping.AUTHCODEDBORA
{
    public class SYS_DEPARTMENTMap : EntityTypeConfiguration<SYS_DEPARTMENT>
    {
        public SYS_DEPARTMENTMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.DEPTID)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.DEPTNO)
                .HasMaxLength(50);

            this.Property(t => t.DEPTCNAME)
                .IsRequired()
                .HasMaxLength(30);

            this.Property(t => t.DEPTENAME)
                .HasMaxLength(30);

            this.Property(t => t.PARTENTID)
                .HasMaxLength(50);

            this.Property(t => t.DEPARTMANAGER)
                .HasMaxLength(50);

            this.Property(t => t.TELEPHONE)
                .HasMaxLength(50);

            this.Property(t => t.FAX)
                .HasMaxLength(50);

            this.Property(t => t.ISENABLE)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(1);

            this.Property(t => t.REMARK)
                .HasMaxLength(100);

            this.Property(t => t.CREATOR)
                .HasMaxLength(50);

            this.Property(t => t.UPDATEUSER)
                .HasMaxLength(50);

            this.Property(t => t.ID)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("SYS_DEPARTMENT", "LYHADMIN");
            this.Property(t => t.DEPTID).HasColumnName("DEPTID");
            this.Property(t => t.DEPTNO).HasColumnName("DEPTNO");
            this.Property(t => t.DEPTCNAME).HasColumnName("DEPTCNAME");
            this.Property(t => t.DEPTENAME).HasColumnName("DEPTENAME");
            this.Property(t => t.PARTENTID).HasColumnName("PARTENTID");
            this.Property(t => t.DEPARTMANAGER).HasColumnName("DEPARTMANAGER");
            this.Property(t => t.TELEPHONE).HasColumnName("TELEPHONE");
            this.Property(t => t.FAX).HasColumnName("FAX");
            this.Property(t => t.ORDERNUM).HasColumnName("ORDERNUM");
            this.Property(t => t.ISENABLE).HasColumnName("ISENABLE");
            this.Property(t => t.REMARK).HasColumnName("REMARK");
            this.Property(t => t.CREATOR).HasColumnName("CREATOR");
            this.Property(t => t.CREATEDATE).HasColumnName("CREATEDATE");
            this.Property(t => t.UPDATEUSER).HasColumnName("UPDATEUSER");
            this.Property(t => t.UPDATEDATE).HasColumnName("UPDATEDATE");
            this.Property(t => t.ID).HasColumnName("ID");
        }
    }
}
